﻿using System;
using System.Configuration;
using Quartz;
using Quartz.Impl;

namespace In.TaskRunner
{
    class Program
    {
        static void Main(string[] args)
        {
            IScheduler sched = null;
            if (ConfigurationManager.AppSettings["StartQuartz"] == "true")
            {
                //启动 Quartz
                ISchedulerFactory sf = new StdSchedulerFactory();
                sched = sf.GetScheduler();

                sched.Start();
            }

            Console.WriteLine("In.TaskRunner 服务程序已启动！");
            Console.WriteLine("输入 exit 来终止程序.");
            while (true)
            {
                if (Console.ReadLine() == "exit")
                {
                    sched?.Shutdown(true);
                    break;
                }
            }
        }
    }
}
